void parse() {
  var u = Uri.parse('http://192.168.0.91:8089/api/v1');
  print('path ${u.path}');
  print('host ${u.host}');
  print('port ${u.port}');
}

void parse_err() {
  try {
    var parse = Uri.parse('hello world');
    print('parse $parse');
  } on FormatException {
    print('FormatException');
  } catch (e) {
    print('err ${e}');
  }
}

void parseUriTest() {
  var uri = Uri.parse('https://example.org:8080/foo/bar#frag');
  assert(uri.scheme == 'https');
  assert(uri.host == 'example.org');
  assert(uri.path == '/foo/bar');
  assert(uri.fragment == 'frag');
  assert(uri.origin == 'https://example.org:8080');
}

void tryParseTest() {
  try {
    var parse = Uri.tryParse('hello world');
    print('parse $parse');
  } on FormatException {
    print('FormatException');
  } catch (e) {
    print('err ${e}');
  }
}

main() {
  parse();
  parse_err();
  parseUriTest();
  tryParseTest();
}
